home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-03 / qbpacket.zip / METRIC.BAS < prev    next >
BASIC Source File  |  1991-10-07  |  1KB  |  52 lines

  1. REM METRIC CONVERSION PROGRAM (METRIC.BAS)
  2. REM-This program uses the DATA and READ
  3. REM-statements to initialize arrays for
  4. REM-metric conversion.
  5.  
  6. REM-Initialize the arrays
  7. Slct = 1
  8. N = 3
  9. DIM M$(N), Q$(N), A$(N), B$(N), F(N)
  10.  
  11. REM-Data for arrays
  12.  
  13. DATA " 1  Inches to centimeters"
  14. DATA "Enter inches","inches","centimeters",2.54
  15.  
  16. DATA " 2  Pounds to kilograms"
  17. DATA "Enter pounds","pounds","kilograms",.4536
  18.  
  19. DATA " 3  Quarts to liters"
  20. DATA "Enter quarts","quarts","liters",.9463
  21.  
  22. REM-Read the arrays
  23. FOR I = 1 TO N
  24.    READ M$(I), Q$(I), A$(I), B$(I), F(I)
  25. NEXT
  26.  
  27. DO
  28.    REM-Display the menu
  29.    PRINT : PRINT "Metric Conversion Program": PRINT
  30.    FOR I = 1 TO N
  31.       PRINT M$(I)
  32.    NEXT I
  33.    PRINT N + 1; " To end the program"
  34.  
  35.    REM-Enter the selection
  36.    INPUT "Enter the number for your selection"; Slct
  37.    IF Slct < 1 OR Slct >= N + 1 THEN EXIT DO
  38.    GOSUB Convert
  39. LOOP
  40.  
  41. PRINT "Program ended"
  42. END
  43.  
  44. Convert:
  45.    REM-Do the conversion
  46.    CLS
  47.    PRINT : PRINT Q$(Slct);
  48.    INPUT X
  49.    PRINT X; A$(Slct); " is equal to"; X * F(Slct); B$(Slct)
  50.    RETURN
  51.  
  52.